package com.itheima;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class Advice {
 @Pointcut("execution(void com.itheima.Demo01.*())")
 private void pt(){}

 @Around(" Advice.pt()")
    public Object time(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
     long l = System.currentTimeMillis();
     for (int i = 0; i < 10000; i++) {
         proceedingJoinPoint.proceed();
     }
     long z = System.currentTimeMillis();
     System.out.println((z-l)+"ms");
     return 1;
 }
}
